<?PHP
class OAuthButton_Widget extends WP_Widget {

	function __construct() {
		$widget_ops = array(
			'classname' => '',
			'description' => 'Login via Facebook/Google+'
		);
		$this->WP_Widget( 'gp_widget_oauth', 'Login with: Facebook/Google+', $widget_ops );
	}
	
	// User interface
	public function widget( $args, $instance ) {
		if( is_user_logged_in() == false && function_exists('execute_ALSDKFLSDMC347529DFIDK823'))
		{?>
		<div class='widget-container'>
		<?PHP
			if($instance['gplus_oauth_providerGoogle'])
			{			
				echo '<div style="margin:5px;float:left;">';
				execute_ALSDKFLSDMC347529DFIDK823('google');
				echo '</div>';
			}
			if($instance['facebook_oauth_fbCheck'])
			{
				echo '<div style="margin:5px;float:left;">';
				execute_ALSDKFLSDMC347529DFIDK823('facebook');
				echo '</div>';
			}
		?>
		</div>
		<?PHP	
		}
	}

	// Admin panel
	public function form( $instance ) {
		?>
		<p>
		<input name="<?php echo $this->get_field_name( 'facebook_oauth_fbCheck' ); ?>"  type="checkbox" <?php echo checked($instance['facebook_oauth_fbCheck'],'on'); ?> />Facebook<br>
		<input name="<?php echo $this->get_field_name( 'gplus_oauth_providerGoogle' ); ?>" type="checkbox" <?php echo checked($instance['gplus_oauth_providerGoogle'],'on'); ?> />Google
		</p>
		<?php 
	}
	
	// Admin panel + New values updated
	public function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
		$instance['facebook_oauth_fbCheck'] = $new_instance['facebook_oauth_fbCheck'];
		$instance['gplus_oauth_providerGoogle'] = $new_instance['gplus_oauth_providerGoogle'];
		return $instance;
	}

} // class Foo_Widget


?>